home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
- Subject: Re: Seek unix2dos.c OR help with tr
- Date: Sat, 16 Mar 96 01:03:40 GMT
- Organization: none
- Message-ID: <826938220snz@genesis.demon.co.uk>
- References: <4i0946$7io@nuke.csu.net> <danpop.826545577@rscernix> <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca> <4ia0kj$d8s@solutions.solon.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4ia0kj$d8s@solutions.solon.com>
- seebs@solutions.solon.com "Peter Seebach" writes:
-
- >In article <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca>,
- >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- >>When I know that I'm specifically dealing with ASCII control chars, I have a
- >>macro like:
- >
- >>#define CTRL(C) ((C)-64)
- >
- >>which I then use with capital letters:
- >
- >> switch(char) {
- >> case CTRL('M'):
- >
- >I always use
- > #define CTRL(x) ((x) & 0x1f)
- >
- >because this preserves the likely semantics of CTRL.
-
- Another common approach is:
-
- #define CTRL(x) ((x) ^ 64)
-
- Since this maps ASCII ^? to 0x7f i.e. DEL.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-